import { http } from "@/utils/http";

export type commonResult<T> = {
  code: number;
  msg: string;
  result: T;
};

export type infoType = {

	id?: number,
	topoName?: string,
	updatedBy?: number,
	updatedByName?: string,
	updatedAt?: string,
	remark?: string,
	unityName?: string,
	topoData?: any,
	topoImg?: string,
}
export type infoTypeList = {
  data: infoType[];
  total: number;
};

const List = '/system/topo/v2/public-topo/tpls';
const Url = '/system/topo/v2/public-topo/tpl';
export const getList = (params?: object) => {
  return http.request<commonResult<infoTypeList>>("get", List, {
    params
  });
};
export const getInfo = (params?: object) => {
  return http.request<commonResult<infoType>>("get", Url, {
    params
  });
};
export const addInfo = (data?: object) => {
  return http.request<commonResult<any>>("post", Url, {
    data
  });
};
export const editInfo = (data?: object) => {
  return http.request<commonResult<any>>("put", Url, {
    data
  });
};
export const deleteInfo = (data?: object) => {
  return http.request<commonResult<any>>("delete", Url, {
    data
  });
};

const groupUrl = '/system/topo/v2/public-topo/group'

/** 5.1.1 获取模板分组 */
export const getGroupList = (params?: object) => {
  return http.request<commonResult<any>>("get", groupUrl, {
    params
  });
};
/** 5.1.2 添加模板文件夹 */
export const addGroup = (data?: object) => {
  return http.request<commonResult<any>>("post", groupUrl, {
    data
  });
};
/** 5.1.3 编辑模板文件夹 */
export const editGroup = (data?: object) => {
  return http.request<commonResult<any>>("put", groupUrl, {
    data
  });
};
/** 5.1.4 删除模板文件夹 */
export const deleteGroup = (data?: object) => {
  return http.request<commonResult<any>>("delete", groupUrl, {
    data
  });
};